package com.eastfair.venueservice.service;

import cn.hutool.core.util.StrUtil;
import com.eastfair.auth.dto.UserAccountDto;
import com.eastfair.auth.vo.UserAccountVo;
import com.eastfair.core.exception.BizException;
import com.eastfair.venueservice.dto.RegisterDTO;
import com.eastfair.venueservice.enumeration.RegisterRoleEnum;
import com.eastfair.venueservice.enumeration.ServiceProviderRoleEnum;
import com.eastfair.venueservice.enumeration.ServiceProviderTypeEnum;
import com.eastfair.venueservice.exceptioncode.VenueServiceExceptionCode;

public interface RegisterService {


    UserAccountVo registerSubSystemUser(RegisterDTO registerDTO);


    /**
     * 服务商类型获取服务商基础角色
     * @param registerRole
     * @return
     */
    static RegisterRoleEnum getRegisterRole(String registerRole) {
        if (StrUtil.isBlank(registerRole)) {
            throw BizException.wrap(VenueServiceExceptionCode.SERVICE_PROVIDER_TYPE_NOT_NULL);
        }
        if (ServiceProviderTypeEnum.MATCHING_SERVICE_PROVIDER.getCode().equals(registerRole)) {
            return RegisterRoleEnum.MATCHING_ORDINARY_ROLE;
        }
        if (ServiceProviderTypeEnum.BUILD_SERVICE_PROVIDER.getCode().equals(registerRole)) {
            return RegisterRoleEnum.BUILD_ORDINARY_ROLE;
        }
        if (ServiceProviderTypeEnum.HOME_SERVICE_PROVIDER.getCode().equals(registerRole)) {
            return RegisterRoleEnum.HOME_ORDINARY_ROLE;
        }
        if (ServiceProviderTypeEnum.MAIN_TRANSPORT_SERVICE_PROVIDER.getCode().equals(registerRole)) {
            return RegisterRoleEnum.TRANSPORT_ORDINARY_ROLE;
        }
        return null;
    }
}
